#!/bin/sh

mysqldiff

# add a delegate + ds
cleannsupdate <<!
server $nameserver $port
zone test.dyndns
update add ns1.del.test.dyndns. 3600 A 127.0.0.1
update add del.test.dyndns. 3600 NS ns1.del.test.dyndns
update add del.test.dyndns. 3600 DS 39274 8 2 8E8A8CFB40FD0C30BFA82E53752E1C257DAFB7B6206D12B9EDA43AF3 EAB2157D
send
answer
!

# check if the record was added
mysqldiff 1 "Check delegate and DS added correctly"

# delete the just added record
cleannsupdate <<!
server $nameserver $port
zone test.dyndns
update delete ns1.del.test.dyndns. A
update delete del.test.dyndns. NS
update delete del.test.dyndns. DS
send
answer
!

# check if the record was deleted
mysqldiff 2 "Check if record is gone"

# add a delegate + ds
cleannsupdate <<!
server $nameserver $port
zone test.dyndns
update add del.test.dyndns. 3600 DS 39274 8 2 8E8A8CFB40FD0C30BFA82E53752E1C257DAFB7B6206D12B9EDA43AF3 EAB2157D
update add del.test.dyndns. 3600 NS ns1.del.test.dyndns
update add ns1.del.test.dyndns. 3600 A 127.0.0.1
send
answer
!

# check if the record was added
mysqldiff 3 "Check delegate and DS added correctly again (other way around)"

# delete the just added record
cleannsupdate <<!
server $nameserver $port
zone test.dyndns
update delete del.test.dyndns. DS
update delete del.test.dyndns. NS
update delete ns1.del.test.dyndns. A
send
answer
!

# check if the record was deleted
mysqldiff 4 "Check if record is gone again"
